|
|
|
|
|
|
|
Me.Height = dtaMain.Top + dtaMain.Height + 525
bFirstLoad = False
End Sub
Private Sub Form_Load()
bFirstLoad = True
End Sub |
|
|
|
|
|
|
|
|
This code adds a new label and text box for each field after the first one. New controls are positioned directly below the last set of controls. Next, the code assigns the Caption property of the Label control and the DataField property of the TextBox control. After all the fields have been added, the code positions the Data control below the other controls and resizes the form to accommodate all the controls. A runtime example of the form is shown in Figure 13.8. |
|
|
|
|
|
|
|
|
Figure 13.8
The generic data form can handle almost any recordset. |
|
|
|
|
|
|
|
|
In this chapter, you learned some of the techniques you can use to make your programs do more with your controls. You learned how to use control arrays to enhance your ability to work with similar controls as a group. You also saw how to add controls dynamically while your program is running. |
|
|
|
|
|
|
|
|
For more information on some of the topics presented here, see the following chapters: |
|
|
|
|
|
|
|
|
To learn more about controls in general, see Chapter 4, "Using Visual Basic's Default Controls," and Chapter 12, "Microsoft Common Controls." |
|
|
|
|
|
|
|
|
Databases and recordsets are introduced in Chapter 24, "Database Basics," and discussed further in Chapter 26, "Using Data Access Objects (DAO)." |
|
|
|
|
|